<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<script type="text/javascript" src="jquery.min.js"></script>
	<script type="text/javascript" src="md5.js"></script>
	<title>Document</title>
</head>
<body>
	<script type="text/javascript">

		
		function countCode(password,key){
			if(password && key){
				var md5one = $.md5(password,key);
				var md5two = $.md5(md5one,'snow');
				var md5three = $.md5(md5one,'kise');
				//计算大小写
				var rule = md5three.split("");
				var source = md5two.split("");
				//console.log(md5one,md5two,md5three,rule,source);
				for(var i=0;i<=31;i++){ 
					if(isNaN(source[i])){
						str ="sunlovesnow1990090127xykab";
						if(str.search(rule[i]) > -1){
							source[i] = source[i].toUpperCase();
						}
					}
				}
				console.log(source.join(""));
				var code32 = source.join("");
				var code1 = code32.slice(0,1);
				if(isNaN(code1)){
					var code16 = code32.slice(0,16);
					}else{
					var code16 = "K" + code32.slice(1,16);
					}
				return code16;
			}
		}
		console.log(countCode('test','test'));
	</script>
</body>
</html>